.basic-content-with-toc {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.basic-content-heading {
  order: -2;
}

#toc {
  order: -1
}

:where(auto-id-table-of-contents) {
  :is(ul, ol) {
    list-style: none !important;
    margin: 0;
    padding: 0;

    :is(ul, ol) {
      margin-left: 1em;
    }
  }

  li {
    font-size: 1rem;
    padding: .125em 0.5em;
  }

  h2 {
    margin-bottom: 0.5em !important;
  }
}

@media (min-width: 768px) {
  .basic-content-with-toc {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .basic-content-heading {
    grid-column: span 2;
  }

  #toc {
    order: unset;
    position: sticky;
    top: 0;
    width: 300px;
    max-height: 100dvh;
    overflow-y: scroll;
  }

  :where(auto-id-table-of-contents) {
    .toc-in-view {
      font-weight: 700;
    }

    li:has(.toc-in-view) {
      background-color: #f5f5f5;
    }
  }
}

@media (min-width: 1280px) {
  :where(auto-id-table-of-contents) {
    li {
      font-size: 1.25rem;
    }
  }
}